package com.gwd.task.model;

import cn.hutool.core.bean.BeanUtil;
import com.gwd.task.entity.CodeRepositoryRelateEntity;
import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhiyongming
 * @date 2020/12/23 15:09
 */
@Getter
@Setter
@NoArgsConstructor
public class CodeSubmitRelateDTO {
    private Long crId;
    private Long repId;
    private Long projectId;
    private String projectName;
    private Integer num;
//    private Long lv1ModuleId;
//    private Long lv2ModuleId;

    private List<CodeSubmitRecordDTO> submitList;

    public CodeSubmitRelateDTO(CodeRepositoryRelateEntity entity) {
        BeanUtil.copyProperties(entity, this);
        this.submitList = new ArrayList<>();
    }

    public void addSubmitList(CodeSubmitRecordDTO dto) {
        this.submitList.add(dto);
    }

    public void computeNum() {
        this.num = this.submitList.size();
    }
}
